package com.bigwork.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.bigwork.enums.OrderStatus;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@TableName("orders")
@Data
public class Order {
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private String orderNumber;
    private Long userId;
    private BigDecimal totalPrice;
    private OrderStatus status;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

    // 此字段不与数据库表直接映射，用于存放查询出的订单项
    @TableField(exist = false)
    private List<OrderItem> items = new ArrayList<>();
}